//
//  LYMineCommentCell.m
//  artist
//
//  Created by Jay_Apple on 16/5/10.
//  Copyright © 2016年 viviyoo. All rights reserved.
//

#import "LYMineCommentCell.h"
#import "LYMineCommentModel.h"
#import "NSDate+Utils.h"

@interface LYMineCommentCell ()

@property (weak, nonatomic) IBOutlet UIImageView *icon;

@property (weak, nonatomic) IBOutlet UILabel *name;
@property (weak, nonatomic) IBOutlet UILabel *title;
@property (weak, nonatomic) IBOutlet UIView *starView;

@property (weak, nonatomic) IBOutlet UILabel *time;

@property (weak, nonatomic) IBOutlet UILabel *content;


@end

@implementation LYMineCommentCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (void)setModel:(LYMineCommentModel *)model{


    _model = model;
    
    
    [self.icon setHeader:_model.from_head_pic];
    
    self.name.text = _model.from_nick_name;
    
    self.title.text = _model.course_title;
    
    self.content.text = _model.content;
    
    //星星
    for (NSInteger i = 0; i < 5; i++) {
        
        UIImageView *imageV = self.starView.subviews[i];
        if (i < _model.star) {
            imageV.image = [UIImage imageNamed:@"全星"];
        }else{
            imageV.image = [UIImage imageNamed:@"空星"];
        }
        
    }
    
    //时间
    NSDate *date = [NSDate dateFromTimeStampString:_model.create_time];
    self.time.text = [date string];
    

}

@end
